<?php
if (!defined('W_ROOT')) {
	exit();
}
?>
 <?php
        $id = !empty($_GET['id'])?$_GET['id']:"";
        $sql = "SELECT * FROM tbluser WHERE id = $id LIMIT 1";
        $Results = mysql_query($sql);
        $UserRow = mysql_fetch_object($Results);
    ?>
	<div class="breadcrumb">
        <a href="<?php echo base_url_admin;?>"><?php echo $lang['HOME'];?></a>
         :: <a href="index.php?view=list"><?php echo $lang['LIST_USER'];?></a>
         :: <a href="#">View a user</a>
      </div>
<div class="heading">
	<h1><img src="../templates/image/user.png" alt="" />
		<?php 
			echo $UserRow->first_name.' '.$UserRow->last_name;
		?>
		<?php 
		$sql_upgrad_account = mysql_query("SELECT *FROM tbl_refcode WHERE ref_type='user_upgrade' AND ref_oject_id='".$UserRow->id."' LIMIT 1");
		$rows_upgrad_account = mysql_num_rows($sql_upgrad_account);
		$rows_refcode = mysql_fetch_object($sql_upgrad_account);
		if($rows_upgrad_account > 0){
			echo "<span style='color:red;'>(Upgrade account)</span>";
		}
		?>
		</h1>
	<div class="buttons">
			<?php 
            	if (1 == $UserRow->user_type_id && 4 == $UserRow->user_type_id) {
						echo '';
					} else {
						if(4 != $UserRow->user_type_id && 1 != $UserRow->activated_status && 3 != $UserRow->user_type_id || !empty($rows_refcode->ref_value)){
						?>
							 <a href="<?php echo base_url_admin;?>/user/process.php?action=aproved&amp;id=<?php echo @$id;?>&amp;activateid=<?php echo @$UserRow->activate; ?>&amp;email=<?php echo @$UserRow->email; ?>&amp;name=<?php echo @$UserRow->last_name; ?>&amp;account_type_id=<?php echo @$rows_refcode->ref_value;?>&user_type_id=<?php echo @$UserRow->user_type_id;?>" class="button">Activated</a>
						<?php 
						}
						
					}
            	?>
            <a href="<?php echo base_url_admin;?>/user/index.php?view=list" class="button"><?php echo $lang['BACK'];?></a>
        </div>
</div>
<div class="content">
<br/>
			<fieldset class="acc_info">
				<legend>Account Info</legend>
				<table cellpadding="5" cellspacing="5" border="0" width="100%" align="center">
					<tr> 
					   <td width="30%" height="30" align="left" valign="top"><!--First Name--><?php echo $lang['SHIP_FIR_NAME'] ;?></td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="60%" align="left">
						   <?php echo $UserRow->first_name;?>
					   </td>
					</tr>
					<tr> 
					   <td width="10%" height="30" align="left" valign="top"><!--Last Name--><?php echo $lang['SHIP_LAS_NAME'];?></td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="80%" align="left">
							<?php echo $UserRow->last_name;?>
					   </td>
					</tr>
					<tr> 
					   <td width="10%" height="30" align="left" valign="top">User type</td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="80%" align="left">
							<?php 
								switch (@$UserRow->user_type_id) {
									case 2:
										echo "Premium account";
									break;
									case 3:
										echo "Free account";
									break;
									case 4:	
										echo "Administrator";
										break;
								}
							?>
					   </td>
					</tr>
					<tr> 
					   <td width="10%" height="30" align="left" valign="top">Email</td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="80%" align="left">
							<?php echo $UserRow->email;?>
					   </td>
					</tr>
					<tr> 
					   <td width="10%" height="30" align="left" valign="top">Telephone</td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="80%" align="left">
							 <?php echo $UserRow->phone;?>
					   </td>
					</tr>
					<tr>
					<td>&nbsp;</td>
					</tr>
			</table>
			</fieldset>
			<?php if(!empty($rows_refcode->ref_value)){?>
			<fieldset class="acc_type">
				<legend>Account Type</legend>
				 <?php 
				 	$sql_type = "SELECT * FROM tbluser_account_type WHERE id='".@$UserRow->account_type_id."'";
					 $sql_account = mysql_query($sql_type);
					$result_account = mysql_fetch_object($sql_account);
				 ?>
				<table cellpadding="5" cellspacing="5" border="0" width="100%" align="center">
					<tr> 
					   <td width="30%" height="30" align="left" valign="top">Account Type</td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="60%" align="left">
						   <?php echo '<span style="color:#090;">'.$result_account->account_type_name.'</span>';?>
					   </td>
					</tr>
					<tr> 
					   <td width="10%" height="30" align="left" valign="top">Fee</td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="80%" align="left">
							<?php echo '$ &nbsp;'.$result_account->account_price;?>
					   </td>
					</tr>
					<tr> 
					   <td width="10%" height="30" align="left" valign="top">Product Limited</td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="80%" align="left">
							<?php echo $result_account->limit_product;?>
					   </td>
					</tr>
					<tr> 
					   <td width="10%" height="30" align="left" valign="top">Account Expired</td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="80%" align="left">
							 <?php echo $result_account->account_expire.'<span style="color:#090;">&nbsp;days</span>'?>
					   </td>
					</tr>
					<tr> 
						<td align="left" valign="top"><?php echo $lang['DISCRIPTION']; ?></td>
						<td valign="top" align="left">:</td>
						<td align="left">
							<?php echo $result_account->description!=''?$result_account->description:'No';?>
						</td>
					</tr>
					<tr>
					<td>&nbsp;</td>
					</tr>
			</table>
			</fieldset>
	<?php } ?>
	<?php 
		$sql_account_upgrad = mysql_query("SELECT * FROM tbluser_account_type WHERE id='".@$rows_refcode->ref_value."'");
		$result_account_upgrad = mysql_fetch_object($sql_account_upgrad);
		if(!empty($result_account_upgrad)){
	?>
		<td>
			<fieldset class="upgrade_account">
				<legend>Upgrade Account</legend>
				<table cellpadding="5" cellspacing="5" border="0" width="100%" align="center">
					<tr> 
					   <td></td>
					   <td width="50%" height="30" align="left" valign="top">Account Type</td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="55%" align="left">
						   <?php echo '<span style="color:#090;">'.@$result_account_upgrad->account_type_name.'</span>';?>
					   </td>
					</tr>
					<tr>
					   <td></td>
					   <td width="10%" height="30" align="left" valign="top">Fee</td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="80%" align="left">
							<?php echo '$ &nbsp;'.@$result_account_upgrad->account_price;?>
					   </td>
					</tr>
					<tr>
					   <td width="3%" style="text-align:left;"><b style="color:#093;font-size:20px;">&rArr;</b></td>
					   <td width="30%" height="30" align="left" valign="top">Product Limited</td>
					   <td width="7%" align="left" valign="top">:</td>
					   <td width="60%" align="left">
							<?php echo @$result_account_upgrad->limit_product;?>
					   </td>
					</tr>
					<tr> 
					    <td></td>
					   <td width="10%" height="30" align="left" valign="top">Account Expired</td>
					   <td width="5%" align="left" valign="top">:</td>
					   <td width="80%" align="left">
							 <?php echo @$result_account_upgrad->account_expire.'<span style="color:#090;">&nbsp;days</span>'?>
					   </td>
					</tr>
					<tr> 
						<td></td>
						<td valign="top" align="left"><?php echo $lang['DISCRIPTION']; ?></td>
						<td valign="top" align="left">:</td>
						<td align="left">
							<?php echo @$result_account_upgrad->description!=''?@$result_account_upgrad->description:'No';?>
						</td>
					</tr>
						<tr>
						<td>&nbsp;</td>
					</tr>
				</table>
			</fieldset>
		<?php
		}
		?>
</div>
</div><!--<div class="row">-->

